load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load(
    "@fbsource//xplat/folly:defs.bzl",
    "folly_xplat_library",
)
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "settings_settings",
    srcs = [
        "Immutables.cpp",
        "Settings.cpp",
        "Types.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Immutables.h",
        "Settings.h",
        "Types.h",
        "detail/SettingsImpl.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//xplat/folly:conv",
        "//xplat/folly:function",
        "//xplat/folly:likely",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly:synchronized",
        "//xplat/folly:thread_local",
        "//xplat/folly:utility",
        "//xplat/folly/concurrency:singleton_relaxed_counter",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/lang:aligned",
    ],
)

# !!!! fbcode/folly/settings/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

fbcode_target(
    _kind = cpp_library,
    name = "settings",
    srcs = [
        "Settings.cpp",
    ],
    headers = [
        "Settings.h",
        "detail/SettingsImpl.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:synchronized",
    ],
    exported_deps = [
        ":immutables",
        ":types",
        "//folly:conv",
        "//folly:cpp_attributes",
        "//folly:function",
        "//folly:likely",
        "//folly:optional",
        "//folly:portability",
        "//folly:shared_mutex",
        "//folly:thread_local",
        "//folly:utility",
        "//folly/concurrency:singleton_relaxed_counter",
        "//folly/container:f14_hash",
        "//folly/container:map_util",
        "//folly/lang:aligned",
        "//folly/synchronization:relaxed_atomic",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "command_line_parser",
    srcs = [
        "CommandLineParser.cpp",
    ],
    headers = [
        "CommandLineParser.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:exception_string",
        "//folly:function",
        "//folly:string",
        "//folly/logging:logging",
    ],
    exported_deps = [
        ":settings",
        ":settings_accessor_proxy",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "settings_accessor_proxy",
    srcs = [
        "SettingsAccessorProxy.cpp",
    ],
    headers = [
        "SettingsAccessorProxy.h",
    ],
    exported_deps = [
        ":settings",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "observer",
    headers = [
        "Observer.h",
    ],
    exported_deps = [
        ":settings",
        "//folly/observer:observer",
        "//folly/observer:simple_observable",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "types",
    srcs = [
        "Types.cpp",
    ],
    exported_deps = [
        "//folly:conv",
        "//folly:expected",
        "//folly:unit",
        "//folly:utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "immutables",
    srcs = [
        "Immutables.cpp",
    ],
    deps = [
        "//folly:indestructible",
        "//folly:synchronized",
    ],
    exported_deps = [
        "//folly/container:f14_hash",
    ],
)
